package VWorldGameStudio;

import java.awt.Image;
import java.awt.Toolkit;

public class FCBlock extends Sprite{
	private String ID;//方块ID
	private String type;//方块属性
	private String[] pngurl;//方块材质列表
	private int[][] model;//方块材质的拼接方式记录
	private int[][] coor;//方块实体部分记录，0为穿透，1为人物可穿透，2为皆不可穿透，3海
	private String eventID;//触发事件ID
	private Image[][] im;
	
	public void registerBlock(String ID,String type,String[] pngurl,int[][] model,int[][] coor,String eventID) {
		this.coor=coor;
		this.eventID=eventID;
		this.ID=ID;
		this.model=model;
		this.pngurl=pngurl;
		this.type=type;
		im=new Image[model.length][model[0].length];
		for(int i=0;i<model.length;i++)
			for(int j=0;j<model[i].length;j++)
				if(model[i][j]>-1) im[i][j]=Toolkit.getDefaultToolkit().getImage(pngurl[model[i][j]]);
				else im[i][j]=null;
		if(ID.indexOf("rqa")>-1)System.out.println(model.length+","+model[0].length);
	}
	public void updataBlock(String ID,String type,String[] pngurl,int[][] model,int[][] coor,String eventID) {
		this.coor=coor;
		this.eventID=eventID;
		this.ID=ID;
		this.model=model;
		this.pngurl=pngurl;
		this.type=type;
	}
	//获取png的矩阵
	public Image[][] getBlockImage() {
		return im;
	}
	//获取方块材质列表
	public String[] getBlockPngUrl() {
		return pngurl;
	}
	//获取方块模型
	public int[][] getBlockModel(){
		return model;
	}
	//获取ID
	public String getBlockID() {
		return ID;
	}
	//获取方块实体部分
	public int[][] getBlockCoor(){
		return coor;
	}
	//获取方块触发事件
	public String getEventID() {
		return eventID;
	}
	//获取方块属性
	public String getBlockType() {
		return type;
	}
	
	public void fcRun() {}//运行函数
}
